﻿package view.prompt
{
    import com.core.*;
    import flash.display.*;
    import flash.events.*;
    import flash.geom.*;
    import manager.*;
    import morn.core.components.*;
    import morn.core.handlers.*;

    public class EmailPrompt extends ButtonPromptCell
    {
        private var img_bg:Image;
        private var txt_count:Label;
        private var angleBox:Box;

        public function EmailPrompt()
        {
            return;
        }// end function

        override public function createCell(param1:Sprite, param2:Object, param3:Handler) : void
        {
            super.createCell(param1, param2, param3);
            this.angleBox = new Box();
            this.angleBox.x = 35;
            var _loc_4:Boolean = false;
            this.angleBox.mouseChildren = false;
            this.angleBox.mouseEnabled = _loc_4;
            this.addChild(this.angleBox);
            this.img_bg = new Image("png.common.team_count");
            this.img_bg.mouseEnabled = false;
            this.angleBox.addChild(this.img_bg);
            this.txt_count = new Label();
            var _loc_4:int = 2;
            this.txt_count.y = 2;
            this.txt_count.x = _loc_4;
            this.txt_count.align = "center";
            this.txt_count.stroke = "0x0";
            this.txt_count.color = 16777215;
            this.txt_count.width = 20;
            this.txt_count.mouseEnabled = false;
            this.angleBox.addChild(this.txt_count);
            return;
        }// end function

        override protected function doMouse(event:MouseEvent) : void
        {
            super.doMouse(event);
            PluginManager.instance.changePlugin("email", this.localToGlobal(new Point(0, 0)));
            ModelProxy.change("mainui", "stopemail", null);
            return;
        }// end function

        override public function show(param1:Object) : void
        {
            var _loc_5:Object = null;
            this.angleBox.visible = true;
            if (Boolean(param1))
            {
                WarningManager.show(17);
            }
            else
            {
                WarningManager.show(112);
            }
            var _loc_2:* = PluginManager.instance.getPluginState("email");
            if (_loc_2 == "open")
            {
                return;
            }
            var _loc_3:* = ModelProxy.getValue("data", "emailData");
            var _loc_4:int = 0;
            for each (_loc_5 in _loc_3)
            {
                
                if (_loc_5.state < 2)
                {
                    _loc_4++;
                }
            }
            this.txt_count.text = _loc_4 + "";
            ModelProxy.change("mainui", "playemail", null);
            super.show(param1);
            return;
        }// end function

    }
}
